using UnityEngine;
using GameFramework.Fsm;

namespace LS.Fsm
{
    public class SequenceFsmState<T>: FsmState<SequenceFsmContainer<T>> where T : class
    {
        public void ChangeNextState(IFsm<SequenceFsmContainer<T>> fsm)
        {
            int index = fsm.Owner.IndexOf(this);
            var type = fsm.Owner.GetStateType(index + 1);
            if (type == null)
            {
                fsm.Owner.OnFsmFinished();
            }
        }
    }
}
